//============================================================================
// Name        : generate_test.cpp
// Author      : Medvedeva Anna
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <fstream>
#include <ctime>
#include <cstdlib>
#include <vector>
#include <utility>

using namespace std;

const int MAX_NUMB_VERTICES = 200;
const int NUMB_TESTS = 100;

int main() {
	srand(time(NULL));
	ofstream out("./../my_graph/input.txt");
	//out << "Полные графы:\n";
	for (int i = 0; i < NUMB_TESTS; i ++){
		int numbVert = 1 + rand() % MAX_NUMB_VERTICES;
		int numbEdges = numbVert*(numbVert - 1)/2;
		out << numbVert << " "<< numbEdges << " 0\n";
		for (int j = 1 ; j < numbVert; j++){
			for (int k = j + 1; k <= numbVert; k++ ){
				out << j << " "<< k << endl;
			}
		}
		cout << endl;
	}
	for (int i = 0; i < NUMB_TESTS; i ++){
			int numbVert = 1 + rand() % MAX_NUMB_VERTICES;
			vector<pair<int, int> > edges;
			//cout << "size = " << edges.size() << endl;
			double p = (rand() % 1000000) / 1000000.0;					//вероятность появления ребра
			//cout << "\t\t\t" << p << endl;
			for (int j = 1 ; j < numbVert; j++){
				for (int k = j + 1; k <= numbVert; k++ ){
					double f = (rand() % 1000000) / 1000000.0;
					//cout << "f = " << f << endl;
					if (f < p) {
						pair<int,int> newEdge(j, k);
						edges.push_back(newEdge);
					}
				}
			}
			out << numbVert << " "<< edges.size() << " 0\n";
			for (unsigned int i = 0; i < edges.size(); i++){
				out << edges[i].first << " "<< edges[i].second<< endl;
			}
			out << endl;
	}
	for (int i = 0; i < NUMB_TESTS; i ++){
		int numbVert = 1 + rand() % MAX_NUMB_VERTICES;
		out << numbVert << " "<< numbVert - 1 << " 0\n";
		for (int j = 2 ; j <= numbVert; j++){
			out << j << " " << rand() % (j-1) + 1<< endl;
		}
		out << endl;
	}
	return 0;
}
